package com.example.dao;


import com.example.entities.Food;
import com.example.server_engineer.dao.AbstractDao;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * @author Administrator
 */
public interface FoodDao extends
        AbstractDao<Food,Integer>
{

    List<Food> findFoodByBusinessId(Integer BusinessID);

    Food findFoodById(Integer foodId);
    Food findFoodByName(String name);

    @Modifying
    @Transactional
    @Query(value = "update food set img=? where id=?",nativeQuery = true)
    Integer updateImgByFoodId(String img,Integer id);


    Integer findBusinessIdByName(String name);

}
